<form class="form-horizontal row-border" id="ndk-health-form" method="post" action="<?php echo Yii::app()->createUrl('soa/showSoaInternal'); ?>" target="_blank">
	<div class="row">
					<div class="col-md-4">
						<div class="widget box">
							<div class="widget-header">
								<h4><i class="icon-reorder"></i>  List Nota</h4>
							</div>
							<div class="widget-content">
							
				<div class="form-group">
					<label class="col-md-3 control-label">No Polish</label>
					<div class="col-md-9 ">
						<input type="text" name="txt_no_polish" id="txt_no_polish" class="form-control" />
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-md-3 control-label">Marketing </label>
					<div class="col-md-9 ">
						<select name="chosen1" class="col-md-9 select2 full-width-fix required">
							<option></option>
							<?php 
							$marketing = MstMarketing::model()->findAll();
							foreach($marketing as $market):
							?>
							<option value="<?=$market->id;?>"><?=$market->name;?></option>
							<?php endforeach; ?>
						</select>
						<label for="chosen1" generated="true" class="has-error help-block" style="display:none;"></label>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-md-3 control-label">Tgl. Input </label>
					<div class="col-md-9 ">
						<div class="col-md-5">
							<div class="input-group">
								<input type="text"  class="form-control" name="tgl_awal" id="tgl_awal" data-mask = "99-99-9999" /> &nbsp; 
							</div>
						</div>
						<div class="col-md-5">
							<div class="input-group">
						<input type="text" class="form-control" name="tgl_akhir" id="tgl_akhir" data-mask = "99-99-9999" />
						</div>
						</div>
					</div>
				</div>
				
				<div class="form-group">
										<label class="col-md-3 control-label">Jenis Nota <span class="required">*</span></label>
										<div class="col-md-9 clearfix">
											<select name="cb_jns_nota" id="cb_jns_nota" class="col-md-12 select2 full-width-fix required">
												<option></option>
												<option value="1">DN</option>
												<option value="2">CN</option>
											</select>
											<label for="chosen1" generated="true" class="has-error help-block" style="display:none;"></label>
										</div>
									</div>
									
			
	
		<div class="row">
		<div class="col-md-2">
		<input type="button" class="btn btn-default btn-warning" id="btn_show_cicil" value="Preview"> 
		
		</div>
	</div>
		</div>
		</div>
	</div>
	</div>
</form>	

<br/>
<br/>
<div class="row">
					<div class="col-md-12">
						<div class="widget box">
							<div class="widget-header">
								<h4><i class="icon-reorder"></i> List NOTA </h4>
								<div class="toolbar no-padding">
									<div class="btn-group">
										<span class="btn btn-xs widget-collapse"><i class="icon-angle-down"></i></span>
									</div>
								</div>
							</div>
							<div class="widget-content no-padding">
								<table id="tbl_cicilan" class="table table-striped table-bordered table-hover table-checkable table-responsive datatable dataTable ">
									<thead>
										<tr>
											
											<th data-class="expand">Tgl. Input </th>
											<th>No Nota</th>
											<th>Premi + TPL</th>
											<th>Polish</th>
											<th>Diskon Agra</th>
											<th>Diskon Asuransi</th>
											<th>Brokerage</th>
											<th>Broker. %</th>
											<th>Nett To Insurance</th>
											<th>Nominal</th>
											<th>Marketing</th>
										</tr>
									</thead>
									<tbody id="isi_cicilan">
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
				

<script type="text/javascript">
function formatCurrency(total) {
    var neg = false;
    if(total < 0) {
        neg = true;
        total = Math.abs(total);
    }
    return (neg ? "" : '') + parseFloat(total, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString();
}

$("#btn_show_cicil").click(function(e){
	var status = "";
	var action = "";
	var isi_cicilan = "";
	$.ajax({
			type:"POST",
            url:"<?php echo Yii::app()->createUrl('/Finance/showallnota'); ?>",
			data:{},
			dataType:"json",
            success:function(data){
				for(var i=0;i<data.length;i++){
					isi_cicilan += "<tr>" +
					"<td>"+data[i].tgl_input+"</td>"+
					"<td>"+data[i].no_nota+"</td>"+
					"<td>"+data[i].premi+"</td>"+
					"<td>"+data[i].policy_no+"</td>"+
					"<td>"+data[i].diskon_agra+"</td>"+
					"<td>"+data[i].diskon_asuransi+"</td>"+
					"<td>"+data[i].brokerage+"</td>"+
					"<td>"+data[i].brokerage_percent+"</td>"+
					"<td>"+data[i].nett_to_insurance+"</td>"+
					"<td>"+data[i].nominal+"</td>"+
					"<td>"+data[i].marketing+"</td>"+
					"</tr>";
				}
				$("#isi_cicilan").html(isi_cicilan);
				var oTable = $("#tbl_cicilan").dataTable();
				oTable.fnDestroy();
				$("#tbl_cicilan").dataTable();
			}
	});
});//end click


</script>